# Maintainer: Taozuhong <taozuhong@hotmail.com>

_realname=libxmlb
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.3.14
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
pkgdesc="A library to help create and query binary XML blobs (mingw-w64)"
depends=(
  "${MINGW_PACKAGE_PREFIX}-glib2"
  "${MINGW_PACKAGE_PREFIX}-xz"
  "${MINGW_PACKAGE_PREFIX}-zstd"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
  "${MINGW_PACKAGE_PREFIX}-meson"
  "${MINGW_PACKAGE_PREFIX}-pkgconf"
  "${MINGW_PACKAGE_PREFIX}-gtk-doc"
  "${MINGW_PACKAGE_PREFIX}-cc"
)
license=("spdx:LGPL-2.1-or-later")
url="https://github.com/hughsie/libxmlb"
source=("https://github.com/hughsie/libxmlb/releases/download/${pkgver}/libxmlb-${pkgver}.tar.xz"{,.asc})
sha256sums=('a2f0056eed14ff791aee2b08b1514a0f1b6cf215f0579138a8cae8c45a0d3b0f'
            'SKIP')
validpgpkeys=('163EB50119225DB3DF8F49EA17ACBA8DFA970E17') # Richard Hughes <richard@hughsie.com>

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
}

build() {
  mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson setup \
    --prefix=${MINGW_PREFIX} \
    --wrap-mode=nodownload \
    --auto-features=enabled \
    --buildtype=plain \
    "../${_realname}-${pkgver}"

  meson compile
}

package() {
  cd build-${MSYSTEM}
  DESTDIR="${pkgdir}" meson install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
